<template>
    <div class="adeverti">
        <div class="bjImg">
            <img src="@/assets/img/src111_webp.webp" alt="" />
        </div>
        <div class="button" @click="goHome">
            <span>跳过广告{{ num }}s</span>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            num: 3,
            clearNum: null,
        };
    },
    methods: {
        goHome() {
            // 跳转页面推荐
            this.$router.push("/found");
        },
    },
    mounted() {
        this.clearNum = setInterval(() => {
            this.num -= 1;
            if (this.num <= 0) {
                clearInterval(this.clearNum);
                this.$router.push("/found");
            }
        }, 1000);
    },
    beforeDestroy() {
        clearInterval(this.clearNum);
    },
};
</script>
 
<style lang="scss" scoped>
.adeverti {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    .bjImg {
        width: 100%;
        height: 100%;
        position: relative;

        img {
            width: 100%;
            height: 100%;
            z-index: -1;
        }
    }

    .button {
        width: 80px;
        height: 35px;
        z-index: 1;
        position: absolute;
        top: 0;
        //   left: 0;
        right: 0;
        background-color: rgba(50, 43, 43, 0.4);
        border-radius: 30px;
        line-height: 35px;
        text-align: center;
        margin-top: 20px;
        margin-right: 15px;

        span {
            font-size: 12px;
            color: #fff;
            transform: scale(0.3);
        }
    }
}
</style>